Core, API: Append to branch Impl#5010
Conversation
Append changes to snapshot branch - changes after review comments remove space Adding support methods for supporting performing append/delete on branch Removing spaces Removing spaces Removing unwanted vars Adding check for null and invalid branch Adding check for null and invalid branch
|
@amogh-jahagirdar @rdblue Here are the implementation changes as addressed in #4926 (comment) |
|
@jackye1995 Is it possible for you to review this? |
|
@amogh-jahagirdar incorporated your feedback. Thanks for your review. |
|
@rdblue Can you review this ? |
|
@amogh-jahagirdar Thanks for your review ! Incorporated the changes requested. |
|
@rdblue @amogh-jahagirdar I have implemented toBranch method only for Append operations as per suggestion in #4926 (comment). For other operations it will throw an UnsupportedOperationException. Please let me know if this looks good? Can be merged only after #4926 |
fixing tests add new ref Removing unncessary methods spell checks spell checks
|
@rdblue @amogh-jahagirdar After appending to a branch, The sequence number for main ref is continued from last number from branch ref. Should the sequence number continue from last last commit in main ref or branch ref ? Any thoughts appreciated. If the sequence number is continued from branch ref, the linearity is broken. But if we continue from main ref, we will have snapshots with same sequence number. |
|
|
||
| @Override | ||
| public ThisT toBranch(String branch) { | ||
| throw new UnsupportedOperationException("Performing operations on a branch is currently not supported"); |
There was a problem hiding this comment.
nit: the error wording looks a bit confusing to me. Are we planning to support the toBranch method in this class later or is it not envisioned to be supported on this particular class at all? thx!
There was a problem hiding this comment.
@dimas-b , In the PR i have implemented the toBranch only in one of the subclasses of Snapshot producer aka FastAppend class. This is done in order to avoid creating a huge PR and be thorough in testing each of the child operations of snapshot producer. In future my aim is to incrementally raise PR for each of them.
There was a problem hiding this comment.
Thanks for the clarification, @namrathamyske ! Would you mind updating the message to something like Performing SnapshotProducer operations on a branch is currently not supported to avoid making a (false) impression that it is not supported in "general"?.. or use different wording as you see fit. My only concern is that getting the old message in one context might be interpreted that it is not supported anywhere.
|
|
||
| @Override | ||
| public FastAppend toBranch(String branch) { | ||
| Preconditions.checkArgument(branch != null, "branch cannot be null"); |
There was a problem hiding this comment.
Message should be Invalid branch name: null
| public FastAppend toBranch(String branch) { | ||
| Preconditions.checkArgument(branch != null, "branch cannot be null"); | ||
| if (ops.current().ref(branch) == null) { | ||
| super.createNewRef(branch); |
There was a problem hiding this comment.
This should be handled by SnapshotProducer, as I noted on #4926.
|
|
||
| Preconditions.checkArgument(ops.current() | ||
| .ref(branch).type() | ||
| .equals(SnapshotRefType.BRANCH), |
There was a problem hiding this comment.
Does this check need to be split across 3 lines? Or is that autoformatting doing it?
| Preconditions.checkArgument(ops.current() | ||
| .ref(branch).type() | ||
| .equals(SnapshotRefType.BRANCH), | ||
| "%s is not a ref to type branch", branch); |
There was a problem hiding this comment.
Also now that we're creating a branch if it doesn't exist, on commit, we should do a null check. It's okay if the branch is null, since we'll create it. if it's not null, it must be an actual branch. I think this should also reside in snapshot producer as well.
Issue addressed from: #3896
This PR contains the Implementation part from #4926 for only Append to Table operation.
Changes addressed: